<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$this->load->view('logged_in/admin/header', array('current_page' => 0));

?>
	<!-- Main Wrapper -->

<div id="main-wrapper">
	<div class="container">

		<div class="row">
			<?php $this->load->view('logged_in/admin/panel'); ?>

			<div class="8u skel-cell-important">
				<div class="10u panel panel-default" style="margin: 0 auto; text-align: center; border: none;">
					<table class="table mytable">
						<tbody>
						<tr>
							<th style="width: 10%">#</th>
							<th>User</th>
							<th colspan="2" style="width: 40%;">Action</th>
						</tr>
						<?php
						$i = 0;
						foreach ($users as $user) {
							?>
							<tr>
								<td><b><?php echo $i++; ?></b></td>
								<td>
									<h4 style="margin: 0 .5em; text-align: left;"><?php echo $user['name'] ?></h4>
								</td>
								<td>
									<a class="btn btn-warning btn-sm" style="text-decoration: none"
									   href="<?php echo base_url() . 'admin/editUser/' . $user['userid']; ?>">Edit Profile</td>
								</td>
								<td>
									<a class="btn btn-danger btn-sm" style="text-decoration: none;"
									   id="<?php echo 'del_'.$user['userid'];?>"
									   onclick="confirmDel(event)"
									   href="#">Delete</a>
								</td>
							</tr>


						<?php } ?>
						</tbody>
					</table>
				</div>
				<div style="margin: 0 auto; margin-top: 2em; text-align: center; display: <?php echo $pagination=='' ? 'none' : ''?>">
					<div class=" btn-group btn-group btn-group-lg">
						<?php echo $pagination ?>
					</div>
				</div>
				<div style="text-align: center; margin-top: 3em">
					<a href="<?php echo base_url().'admin/addUser'?>" class="btn btn-lg btn-success"
						style="margin: 0 auto; text-decoration: none;">Add User</a>
				</div>
			</div>
		</div>
	</div>
</div>

	<script>
		function confirmDel(event){
			id = event.target.id.split("_")[1];
			var ask=confirm("Are you sure?");
			if(ask==true){
				//window.location.assign("<?php echo base_url().'admin/deleteUser/'?>"+id);
				//todo uncomment
			}
			e.preventDefault();
			return false;
		}
	</script>

<?php
$this->load->view('logged_in/components/footer');
?>